const state = {
	isShow: null,
	playStatus: true, // 默认播放
	isFocus: null
}

const mutations = {
	SET_ISSHOW: (state, data) => {
		state.isShow = data
	},
	SET_PLAY_STATUS: (state, data) => {
		state.playStatus = data
	},
	SET_FOCUS_STATUS: (state, data) => {
		state.isFocus = new Date().getTime()
	}
}

const actions = {
	// 是否在播放页面
	changeShow({ commit }, data) {
		return new Promise((resolve, reject) => {
			//完成http请求
			//then => resolve(response)
			//catch => reject(error)
			commit('SET_ISSHOW', data)
		})
	},
	// 当前播放状态
	changePlayStatus({ commit }, data) {
		return new Promise((resolve, reject) => {
			commit('SET_PLAY_STATUS', data)
		})
	},
	// 关注/取消关注触发
	changeFocusStatus({ commit }, data) {
		return new Promise((resolve, reject) => {
			commit('SET_FOCUS_STATUS', data)
		})
	}
}

export default {
	namespaced: true,
	state,
	mutations,
	actions
}
